﻿using System.Linq;

namespace Equation.Enterprise.Framework.Domain.Data
{
    public static class DbRepositoryHelper
    {
        public static void Attach<T>(this IRepository dbRepository, T target )
            where T : class
        {
            dbRepository.DbContext.Set<T>().Attach(target);
        }

        public static IQueryable<T> AsNoTracking<T>(this IRepository dbRepository)
            where T : class
        {
            return dbRepository.DbContext.Set<T>().AsNoTracking();
        }

        //public static void Detach<T>(this IRepository dbRepository, T target)
        //    where T : class
        //{
        //    dbRepository.DbContext.Set<T>().Remove(target);
        //}
    }
}
